package com.bestvike.stone.core.lang;

/**
 * Created by 许崇雷 on 2016/7/12.
 */
public enum Platform {
    /**
     * Windows 系统
     */
    Windows,
    /**
     * Linux 系统
     */
    Linux,
    /**
     * Mac OS 或 Mac OS X 系统
     */
    Mac,
    /**
     * 其他
     */
    Other;

    //从名称获取平台
    public static Platform forName(String platformID) {
        if (platformID == null)
            return Other;
        platformID = platformID.toLowerCase();
        if (platformID.contains("windows"))
            return Windows;
        else if (platformID.contains("linux"))
            return Linux;
        else if (platformID.contains("mac") && platformID.contains("os"))
            return Mac;
        else
            return Other;
    }
}
